How Accessible Subways Are?
subway_df = read_csv("./Data/NYC_Transit_Subway_Entrance_And_Exit_Data.csv") %>%
janitor::clean_names()
## Rows: 1868 Columns: 32
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (22): Division, Line, Station Name, Route1, Route2, Route3, Route4, Rout...
## dbl (8): Station Latitude, Station Longitude, Route8, Route9, Route10, Rout...
## lgl (2): ADA, Free Crossover
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
# Clean subway data
subway_df = subway_df %>%
select( -ada_notes, -staff_hours, -north_south_street, -east_west_street, -corner) %>%
mutate(
entrance_type = case_when(
entrance_type == "Elevator" ~ 1,
entrance_type == "Ramp" ~ 2,
entrance_type == "Escalator" ~ 3,
entrance_type == "Walkway" ~ 4,
entrance_type == "Door" ~ 5,
entrance_type == "Easement" ~ 6,
entrance_type == "Stair" ~ 7,
TRUE ~ NA_real_ # Handle unexpected values as NA
)
) %>%
mutate(
staffing = factor(
staffing,
levels = c("NONE", "Spc Ev", "PART", "FULL"),
ordered = TRUE
)
)
# ) %>%
# mutate(
# ada = case_when(
# ada == TRUE ~ 1,
# ada == FALSE ~ 0
# )
# )
# Importing NYC map
nyc_map = st_read(here::here('NYC', 'nyc.shp'), quiet = TRUE)
nycmap = st_transform(nyc_map, crs = 4326)
Are there ADA compliances?
subway_df %>%
ggplot() +
geom_sf(
data = nyc_map, fill = NA
) +
geom_point(
aes(x = station_longitude, y = station_latitude, color = ada),
size = 0.5, alpha = 0.5) +
coord_sf() +
theme_void(base_size = 10) +
theme(legend.position = 'bottom') +
guides(color = guide_legend(
title.position = "top",
override.aes = list(size = 3))) +
scale_color_manual(values = c("FALSE" = "aquamarine3", "TRUE" = "slateblue3")) +
labs(color = "ADA Compliance")

subway_df %>%
group_by(ada) %>%
count(ada) %>%
plot_ly (x = ~ada,
y = ~n,
# marker = list(color = ~ifelse(ada == 1, "blue", "red")),
color = ~ada,
type = "bar") %>%
layout(
xaxis = list(title = "Ada Complaince"),
yaxis = list(title = "Number of Stations")
)
## Warning in RColorBrewer::brewer.pal(N, "Set2"): minimal value for n is 3, returning requested palette with 3 different levels
## Warning in RColorBrewer::brewer.pal(N, "Set2"): minimal value for n is 3, returning requested palette with 3 different levels
Are there staffs?
Are there free crossovers?
What are their entrance types?